package com.example.findmystuff;

//import com.database.findmystuff.DB;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class HomeActivity extends Activity {

	Button addLostItem,addFoundItem,viewItems,logout,searchItem;
	//public static DB database = new DB();
	/**
	 * This method is called when the activity is created
	 * @param savedInstanceState a bundle used to save the state that this instance of the activity is in.
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_home);
		
		viewItems = (Button) findViewById(R.id.viewItemsButton);
		addLostItem = (Button) findViewById(R.id.lostItemButton);
		addFoundItem = (Button) findViewById(R.id.foundItemButton);
		searchItem = (Button) findViewById(R.id.searchButton);
		logout= (Button) findViewById(R.id.logoutButton);
		
		viewItems.setOnClickListener ( 
				new View.OnClickListener() {
					
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						Intent i = new Intent(HomeActivity.this, ListItemsActivity.class);
						startActivity(i);
					}
				});
		
		addLostItem.setOnClickListener ( 
				new View.OnClickListener() {
					
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						Intent i = new Intent(HomeActivity.this, AddLostItemActivity.class);
						startActivity(i);
					}
				});
		
		addFoundItem.setOnClickListener ( 
				new View.OnClickListener() {
					
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						Intent i = new Intent(HomeActivity.this, AddFoundItemActivity.class);
						startActivity(i);
					}
				});
		
		searchItem.setOnClickListener ( 
				new View.OnClickListener() {
					
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						Intent i = new Intent(HomeActivity.this, SearchActivity.class);
						startActivity(i);
					}
				});
		
		logout.setOnClickListener ( 
				new View.OnClickListener() {
					
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						MainActivity.loggedUser="";
						Intent i = new Intent(HomeActivity.this, MainActivity.class);
						startActivity(i);
					}
				});
		
	}
	/**
	 * Initializes the contents of the Activity's standard options menu.
	 * @param menu the standard options menu
	 */
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_home, menu);
		return true;
	}

}
